<!--[if !IE]> -->

<script type="text/javascript">
  window.jQuery || document.write("<script src='{{__HOST__}}/admin/js/jquery-2.0.3.min.js'>"+"<"+"script>");
</script>

<!-- <![endif]-->

<!--[if IE]>
<script type="text/javascript">
window.jQuery || document.write("<script src='{{__HOST__}}/admin/js/jquery-1.10.2.min.js'>"+"<"+"script>");
</script>
<![endif]-->

<script type="text/javascript">
  if("ontouchend" in document) document.write("<script src='{{__HOST__}}/admin/js/jquery.mobile.custom.min.js'>"+"<"+"script>");
</script>
<script src="{{__HOST__}}/admin/js/bootstrap.min.js"></script>

<!-- ace scripts -->

<script src="{{__HOST__}}/admin/js/ace-elements.min.js"></script>
<script src="{{__HOST__}}/admin/js/ace.min.js"></script>


<script type="text/javascript">
  jQuery(function($) {
            
    
    $('table th input:checkbox').on('click' , function(){
      var that = this;
      $(this).closest('table').find('tr > td:first-child input:checkbox')
      .each(function(){
        this.checked = that.checked;
        $(this).closest('tr').toggleClass('selected');
      });
        
    });
  
  
    $('[data-rel="tooltip"]').tooltip({placement: tooltip_placement});
    function tooltip_placement(context, source) {
      var $source = $(source);
      var $parent = $source.closest('table')
      var off1 = $parent.offset();
      var w1 = $parent.width();
  
      var off2 = $source.offset();
      var w2 = $source.width();
  
      if( parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2) ) return 'right';
      return 'left';
    }
  })
</script>